#include <iostream>
#include <memory>

#include "Http.hpp"
#include "TcpServer.hpp"

// ./hserver local-port
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cout << "Usage: " << argv[0] << " local-port" << std::endl;
        exit(1);
    }

    uint16_t port = std::stoi(argv[1]);

    HttpServer hserver;

    std::unique_ptr<TcpServer> tsvc = std::make_unique<TcpServer>(
        std::bind(&HttpServer::HandlerRequest, &hserver, std::placeholders::_1),
        port
    );

    tsvc->Loop();

    return 0;
}